#Figure A12

#directory
#set working directory to the path PvP_Replication
#setwd("~/PvP_Replication")

#packages
library(estimatr)
library(texreg)

#load dataset
election_data <- read.csv("PvP_data/PvP_data_main.csv")

#estimate models
left_vote_2010 <- lm_robust(left_pres_pct_10 ~ up_pres_pct_86, election_data)
left_vote_2014 <- lm_robust(left_pres_pct_14 ~ up_pres_pct_86, election_data)
left_vote_2018 <- lm_robust(left_pres_pct_18 ~ up_pres_pct_86, election_data)

#generate table for results
texreg(
  list(left_vote_2010, left_vote_2014, left_vote_2018),
  custom.coef.names	= c(NA, "FARC Political Wing Voteshare (1986)"), 
  custom.header = list("DV = Left Candidate Voteshare: 2010" = 1, "DV = Left Candidate Voteshare: 2014" = 2, "DV = Left Candidate Voteshare: 2018" = 3),
  digits = 2, include.ci = FALSE, single.row = FALSE, include.fstatistic = TRUE, 
  include.rmse = FALSE, include.rsquared = FALSE, include.adjrs = FALSE, 
  include.nobs = TRUE, stars = c(0.001, 0.01, 0.05), float.pos = "h", caption.above	= TRUE, 
  caption = "Historical Support for FARC Political Wing & Contemporary Voteshare of Left Candidates")

